<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">用户黑卡管理</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>
                        <p:columnToggler datasource="galaxyCardUserDataTable" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"
                                         rendered="#{security:areAllGranted('GALAXY_CARD_USER_SEARCH')}"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         actionListener="#{galaxyCardUserListBean.onReset}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{galaxyCardUserListBean.isNormal()}"/>
                        <p:commandButton value="导出" icon="fa fa-download" ajax="false" rendered="#{security:areAllGranted('GALAXY_CARD_USER_EXPORT')}">
                            <p:dataExporter type="xls" target="galaxyCardUserDataTable" fileName="exportCardUser"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>查询条件</h1>
                            <p:panelGrid columns="8" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-2"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;text-align:center;">
                                <p:outputLabel for="platform" value="平台"/>
                                <p:selectOneMenu id="platform" value="#{galaxyCardUserListBean.$.platform}">
                                    <f:selectItem itemLabel="通用" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="Android" itemValue="android"/>
                                    <f:selectItem itemLabel="IOS" itemValue="ios"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="productId" value="产品"/>
                                <p:selectOneMenu id="productId" value="#{galaxyCardUserListBean.$.productId}">
                                    <f:selectItem itemLabel="通用" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{galaxyCardUserListBean.commProductIds}"
                                            var="commProductId"
                                            itemLabel="#{commProductId.name}" itemValue="#{commProductId.id}"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="channelId" value="渠道"/>
                                <p:selectOneMenu id="channelId" value="#{galaxyCardUserListBean.$.channelId}">
                                    <f:selectItem itemLabel="通用" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{galaxyCardUserListBean.commProductChannels}"
                                            var="commProductChannel"
                                            itemLabel="#{commProductChannel.channelName}" itemValue="#{commProductChannel.id}"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="status" value="状态"/>
                                <p:selectOneMenu id="status" value="#{galaxyCardUserListBean.$.status}">
                                    <f:selectItem itemLabel="全部" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="已激活" itemValue="1"/>
                                    <f:selectItem itemLabel="未激活" itemValue="0"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="cardNo" value="卡号"/>
                                <p:inputText id="cardNo" value="#{galaxyCardUserListBean.$.cardNo}"/>
                                <p:outputLabel for="phoneNumber" value="手机"/>
                                <p:inputText id="phoneNumber" value="#{galaxyCardUserListBean.$.phoneNumber}"/>
                                <p:outputLabel for="name" value="姓名"/>
                                <p:inputText id="name" value="#{galaxyCardUserListBean.$.name}"/>

                            </p:panelGrid>
                        </div>
                        <div class="card">
                            <p:dataTable id="galaxyCardUserDataTable"
                                         style="width: 100%"
                                         var="userCard"
                                         value="#{galaxyCardUserListBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         scrollWidth="105%"
                                         reflow="true"
                                         rendered="#{security:areAllGranted('GALAXY_CARD_USER_SEARCH')}"
                                         selection="#{galaxyCardUserListBean.selectedRecords}"
                                         resizableColumns="true">
                                <p:column selectionMode="multiple" style="width:16px;text-align:center"
                                          rendered="#{galaxyCardUserListBean.isBatch()}"/>
                                <p:column headerText="卡激活时间">
                                    <h:outputText value="#{userCard.activeTime}"/>
                                </p:column>
                                <p:column headerText="黑卡卡号">
                                    <h:outputText value="#{userCard.cardNo}"/>
                                </p:column>
                                <p:column headerText="状态">
                                    <h:outputText value="#{userCard.getStatusStr()}"/>
                                </p:column>
                                <p:column headerText="购买平台">
                                    <h:outputText value="#{userCard.platform}"/>
                                </p:column>
                                <p:column headerText="购买产品">
                                    <h:outputText value="#{userCard.product}"/>
                                </p:column>
                                <p:column headerText="购买渠道">
                                    <h:outputText value="#{userCard.channel}"/>
                                </p:column>
                                <p:column headerText="手机号">
                                    <h:outputText value="#{userCard.phoneNumber}"/>
                                </p:column>
                                <p:column headerText="姓名">
                                    <h:outputText value="#{userCard.name}"/>
                                </p:column>
                                <p:column headerText="省" style="text-align:center;width:60px">
                                    <h:outputText value="#{userCard.province}"/>
                                </p:column>
                                <p:column headerText="市" style="text-align:center;width:60px">
                                    <h:outputText value="#{userCard.city}"/>
                                </p:column>
                                <p:column headerText="区" style="text-align:center;width:100px">
                                    <h:outputText value="#{userCard.area}"/>
                                </p:column>
                                <p:column headerText="详细地址" style="width:300px">
                                    <h:outputText value="#{userCard.address}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
